﻿#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>
void change(char* str, int length)
{
	int space = 0;
	char* p = str;
	while (*p)
	{
		if (*p == ' ')
			space++;
		p++;
	}
	char* e1 = str + length - 1;
	char* e2 = str + length - 1 + 2 * space;
	while (e1 != e2)
	{
		if (*e1 != ' ')
		{
			*e2-- = *e1--;
		}
		else
		{
			*e2-- = '0';
			*e2-- = '2';
			*e2-- = '%';
			e1--;
		}
	}

}
int main()
{
	char arr[60] = "we are happy!";
	int ret = strlen(arr);
	change(arr, ret);
	printf("%s\n", arr);
	return 0;
}